﻿@page "/importexportinfo/{Id}"
@using Compass.Wasm.Client.Services.Logistics
@using Compass.Wasm.Shared.Logistics
@inject IImportExportInfoService ImportExportInfoService;
@inject NavigationManager NavigationManager
@inject IJSRuntime JsRuntime

<PageTitle>进出口货物申报要素</PageTitle>
<h5>
    <CompUpdateIcon Roles="admin,pm,mgr" Url="@($"importexportinfo/update/{Id}")" />
    <span style="font-weight: bold">料号：@_dto.MtlNumber</span>
    <span>【品名：@_dto.Name】</span>
</h5>
<div class="col">
    <div class="row">
        <div class="col-sm-3" style="width: 95px">类型:</div>
        <div class="col-sm-9">
            <span>@_dto.Type</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">BU:</div>
        <div class="col-sm-9">
            <span>@_dto.Sbu</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">HS编码:</div>
        <div class="col-sm-9">
            <span>@_dto.HsCode</span>
            <a href="http://old.hscode.net/IntegrateQueries/QueryYS" target="_blank">
                <span class="oi oi-magnifying-glass ms-2"></span>
            </a>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">HS描述:</div>
        <div class="col-sm-9">
            <span>@_dto.HsDescription</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">产地:</div>
        <div class="col-sm-9">
            <span>@_dto.PlaceOfOrigin</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">申报要素:</div>
        <div class="col-sm-9" style="color: red">
            <CompMultiLineText Text="@_dto.DeclarationElements"/>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">净重kg:</div>
        <div class="col-sm-9">
            <span>@_dto.NetWeight</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">采购订单:</div>
        <div class="col-sm-9">
            <span>@_dto.PoNumbers</span>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">内部描述:</div>
        <div class="col-sm-9" style="color: red">
            <CompMultiLineText Text="@_dto.NavDescription" />
        </div>
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">附件:</div>
        <div class="col-sm-9" style="color: red">
            <CompMultiFiles ContentUrl="@_dto.AttachmentsUrl" />
        </div>  
    </div>
    <div class="row">
        <div class="col-sm-3" style="width: 95px">图片:</div>
        <div class="col-sm-9" style="color: red">
            <CompMultiImgs ContentUrl="@_dto.ImagesUrl" />
        </div>
    </div>
</div>


@code {
    [Parameter]
    public string Id { get; set; }
    private ImportExportInfoDto _dto = new();
    protected override async Task OnInitializedAsync()
    {
        var response = await ImportExportInfoService.GetFirstOrDefaultAsync(Guid.Parse(Id));
        if (!response.Status) NavigationManager.NavigateTo("importexportinfos");
        _dto = response.Result;
    }
}
